package com.example.demo.exception;

/**
 * 封装的异常
 */
public class SXException extends RuntimeException {

    private int exceptionCode;

    private String message;

    public SXException(ServiceExceptionEnum serviceExceptionEnum) {
        this.exceptionCode = serviceExceptionEnum.getCode();
        this.message = serviceExceptionEnum.getMessage();
    }

    public SXException(int exceptionCode, String message) {
        this.exceptionCode = exceptionCode;
        this.message = message;
    }

    public SXException(String message) {
        this.message = message;
    }

    public Integer getCode() {
        return exceptionCode;
    }

    public void setCode(Integer code) {
        this.exceptionCode = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
